home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c++-part1 / 3636 < prev    next >
Encoding:
Internet Message Format  |  1996-08-06  |  885 b 

  1. Path: news.ping.at!site73!mgeramb
  2. Newsgroups: comp.lang.c++
  3. Message-ID: <41@site73.site73.ping.at>
  4. Reply-To: mgeramb@site73.site73.ping.at (Michael Geramb)
  5. From: mgeramb@site73.site73.ping.at (Michael Geramb)
  6. Date: Thu, 25 Jan 1996 08:48:52 GMT
  7. Subject: Template casting problem
  8.  
  9. Here is a C++ problem that I never managed to solve.
  10.  
  11. Imagine you create a template of a class :
  12.  
  13. template <class T> class A
  14. {
  15.         ...
  16. };
  17.  
  18. This gives a family of classes (instances), say:
  19.  
  20. A<short>, A<int>, A<float> etc, which may coexist in one function.
  21. Then, a problem arises how to cast one instance to another.
  22.  
  23. As a more concrete example, one may imagine a template CVector which
  24. generates short, integer, float and double instances. 
  25. It also generates a very natural (to my mind) wish to cast 
  26. one instance to another.
  27.  
  28.  
  29.                                Vassili
  30.                                 
  31.  
  32.